<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--suppress ALL-->
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>天天生鲜-用户中心</title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/main.css">
	<script type="text/javascript" src="/js/jquery-1.12.4.min.js"></script>
	<script src="/layui/layui.js"></script>
</head>
<body>
<div class="header_con">
	<div class="header">
		<div class="welcome fl">欢迎来到天天生鲜!</div>
		<div class="fr">
			<div class="login_info fl">
				欢迎您：<em>张 山</em>
			</div>
			<div class="login_btn fl">
				<a href="/index">首页</a>
				<a href="/toLogin" th:if="${session.user==null}">登录</a>
				<span th:if="${session.user!=null}" th:text="'欢迎：'+${session.user.userEmail}" style="color: black"></span>
				<span>|</span>
				<a href="/toRegister">注册</a>
			</div>
			<div class="user_link fl">
				<span>|</span>
				<a href="/toUserCenterInfo">用户中心</a>
				<span>|</span>
				<a href="/carttable/myCart">我的购物车</a>
				<span>|</span>
				<a href="/focustable/myFocus">我的收藏</a>
				<span>|</span>
				<a href="/toUserCenterOrder?currentPage=1&pageSize=4">我的订单</a>
			</div>
		</div>
	</div>
</div>

	<div class="search_bar clearfix">
		<a href="index.html" class="logo fl"><img src="images/logo.png"></a>
		<div class="sub_page_name fl">|&nbsp;&nbsp;&nbsp;&nbsp;用户中心</div>
		<div class="search_con fr">
			<form action="/goodstable/searchForGoods">
				<input type="text" class="input_text fl" name="goodsName" placeholder="搜索商品">
				<input type="submit" class="input_btn fr" name="" value="搜索">
			</form>
		</div>		
	</div>
	<div class="main_con clearfix">
		<div class="left_menu_con clearfix">
			<h3>用户中心</h3>
			<ul>
				<li><a href="/toUserCenterInfo" class="active">· 个人信息</a></li>
				<li><a href="/toUserCenterOrder?currentPage=1&pageSize=4">· 全部订单</a></li>
				<li><a href="/toUserCenterSite">· 收货地址</a></li>
			</ul>
		</div>
		<div class="right_content clearfix">
				<div class="info_con clearfix">
				<h3 class="common_title2">基本信息</h3>
					<ul class="user_info_list">
						<input type="hidden" id="id" th:value="${userInfo.id}"/>
						<li><span>用户名：</span><input id="userName" style="background-color: #f9f9f9;border:0px" type="text" placeholder="请输入您的姓名" name="userName" th:value="${userInfo.userName}">⇦点击修改</li>
						<li><span>联系方式：</span><input id="phone" style="background-color: #f9f9f9;border:0px" type="text" placeholder="请输入您的联系方式" name="phone" th:value="${userInfo.phone}"></li>
						<li><span>收货地址：</span><input id="address" style="background-color: #f9f9f9;border:0px" type="text" placeholder="请输入您的联系地址" name="address" th:value="${userInfo.address}"><button id="btn" type="button" style="float: right">修改</button></li>
					</ul>
				</div>
				<h3 class="common_title2">最近浏览</h3>
				<div class="has_view_list">
					<ul class="goods_type_list clearfix">
				<li th:each="browse,index:${browses}" th:if="${index.index<5}">
					<div th:each="good:${goodstables}" th:if="${good.id==browse.goodId}">
					<a href="detail.html"><img th:src="@{images/{picture}(picture=${good.picture})}"></a>
					<h4><a href="detail.html">[[${good.name}]]</a></h4>
					<div class="operate">
						<span class="prize">￥<span th:text="${good.oldPrice}"></span></span>
						<a href="#" class="add_goods" title="加入购物车"></a>
					</div>
					</div>
				</li>
			</ul>
		</div>
		</div>
	</div>
	<div class="footer">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>		
		</div>
		<p>CopyRight © 2016 北京天天生鲜信息技术有限公司 All Rights Reserved</p>
		<p>电话：010-****888    京ICP备*******8号</p>
	</div>
</body>
<script>
	$("#btn").click(function (){
		var userName=$("#userName").val();
		var phone=$("#phone").val();
		var address=$("#address").val();
		var id = $("#id").val();
		var url="/address/sellerUpdateAddressInfo";
		var param={"userName":userName,"phone":phone,"address":address,"id":id};
		$.getJSON(url,param,function (data){
			if(data.code==200){
				$("#headerName").html(userName);
				layer.msg(data.message);
			}else{
				layer.msg(data.message);
			}
		})
	});
</script>
</html>